<?php

namespace App\Admin\Actions\Grid;

use Dcat\Admin\Actions\Response;
use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Traits\HasPermissions;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;

class Create extends RowAction
{
    /**
     * @return string
     */
	protected $title = '添加试题';
	protected $model;


    public function __construct(string $model=null)
    {
        $this->model=$model;
	}


    public function script()
    {
        return <<<JS
$('.grid-check-row').on('click',function() {
  layer.open({
  type:2,
  title:'试题名称',
  closeBtn:1,
  shadeClose:true,
  //页面路由
  content:"questionCreate",
  area:["800px","400px"]
  })
})
JS;


	}


    public function html()
    {
        $id = $this->getKey();
        $name =$this->row->receiver_name;
        $this->setHtmlAttribute(['data-id'=>$id,'receiver_name'=>$name,'class'=>'grid-check-row']);

        return parent::html();
	}


}
